package des.wangku.operate.standard.swt.table;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.graphics.Point;

public class FormatStylePoint {

	FormatStyle fs = FormatStyle.TEXT;

	List<PointArea> list = new ArrayList<>();

	public FormatStylePoint(FormatStyle fs) {
		this.fs = fs;
	}

	void putall(PointArea... arr) {
		for (PointArea e : arr)
			list.add(e);
	}

	/**
	 * 两点之间的区域
	 * 
	 * @author Sunjian
	 * @version 1.0
	 * @since jdk1.8
	 */
	public static final class PointArea {

		Point leftTop = new Point(-1, -1);

		Point rightBottom = new Point(-1, -1);

		public String print() {
			return "AREA:[" + leftTop.x + "," + leftTop.y + "]---[" + rightBottom.x + "," + rightBottom.y + "]";
		}

		public PointArea(int x1, int y1, int x2, int y2) {
			leftTop.x = x1;
			leftTop.y = y1;
			rightBottom.x = x2;
			rightBottom.y = y2;
		}

		/**
		 * 判断此点是否在此区域内
		 * 
		 * @param x int
		 * @param y int
		 * @return boolean
		 */
		public boolean isInArea(int x, int y) {
			// System.out.println("AREA:["+leftTop.x+","+leftTop.y+"]---["+rightBottom.x+","+rightBottom.y+"]");
			// System.out.println("Point:["+x+","+y+"]");
			boolean isx = x >= leftTop.x && x <= rightBottom.x;
			boolean isy = y >= leftTop.y && y <= rightBottom.y;
			return isx && isy;
		}
	}
}
